$OpenBSD: patch-gnats_regex_c,v 1.2 2007/12/28 17:11:25 espie Exp $
--- gnats/regex.c.orig	Thu Nov  5 20:54:10 1998
+++ gnats/regex.c	Fri Dec 28 18:00:24 2007
@@ -1623,11 +1623,12 @@ regex_compile (pattern, size, syntax, bufp)
             case ')':
               if (syntax & RE_NO_BK_PARENS) goto normal_backslash;
 
-              if (COMPILE_STACK_EMPTY)
+              if (COMPILE_STACK_EMPTY) {
                 if (syntax & RE_UNMATCHED_RIGHT_PAREN_ORD)
                   goto normal_backslash;
                 else
                   return REG_ERPAREN;
+	    }
 
             handle_close:
               if (fixup_alt_jump)
@@ -1643,11 +1644,12 @@ regex_compile (pattern, size, syntax, bufp)
                 }
 
               /* See similar code for backslashed left paren above.  */
-              if (COMPILE_STACK_EMPTY)
+              if (COMPILE_STACK_EMPTY) {
                 if (syntax & RE_UNMATCHED_RIGHT_PAREN_ORD)
                   goto normal_char;
                 else
                   return REG_ERPAREN;
+	      }
 
               /* Since we just checked for an empty stack above, this
                  ``can't happen''.  */
@@ -4903,15 +4905,7 @@ regerror (errcode, preg, errbuf, errbuf_size)
   msg_size = strlen (msg) + 1; /* Includes the null.  */
   
   if (errbuf_size != 0)
-    {
-      if (msg_size > errbuf_size)
-        {
-          strncpy (errbuf, msg, errbuf_size - 1);
-          errbuf[errbuf_size - 1] = 0;
-        }
-      else
-        strcpy (errbuf, msg);
-    }
+    strlcpy (errbuf, msg, errbuf_size);
 
   return msg_size;
 }
